package br.infotec.musicaunb.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.search.annotations.DocumentId;
import org.springframework.data.jpa.domain.AbstractPersistable;
/**
 * entidade representando um bloco
 * @author eduardo
 *
 */
@Entity
@Table(name="instrumento")
public class Instrumento extends AbstractPersistable<Integer> implements AbstraticPojo {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7992236290513286941L;
	private String nome;
	private List<Turma> turmas;
	
	
	@Override
	@GeneratedValue
	@DocumentId
	@Column(name="id_instrumento")
	public Integer getId() {
		return super.getId();
	}
	
	@Column
	public void setNome(String nome) {
		this.nome = nome;
	}
	public String getNome() {
		return nome;
	}
	
	@ManyToMany
	@JoinTable(name = "instrumento_has_turma", joinColumns = { @JoinColumn(name = "id_instumento") }, inverseJoinColumns = { @JoinColumn(name = "id_turma") })
	public List<Turma> getTurmas() {
		return turmas;
	}
	public void setTurmas(List<Turma> turmas) {
		this.turmas = turmas;
	}
	
	

}
